from Lib.Core.UIBase import UIBase


class UIResponse(UIBase):
    def __init__(self, rect, layer):
        super().__init__(rect, layer)
        from constants import game
        game.action_mouse_button_down = self.SetFocus

    def SetFocus(self, pos, buttons):
        import locals
        if locals.mouse_move_focus_ui == self:
            locals.mouse_click_focus_ui = self
        if self.sprites():
            for sp in self.sprites():
                if locals.mouse_move_focus_sprite == sp:
                    locals.mouse_click_focus_sprite = sp
